import request from '/@/utils/request';

/**
 *  商品管理所有api在此！
 */

//---- 货品入库 -----
// 列表
export const fetchWarehousingList = (params?: object) => {
	return request({
		url: '/product/warehouse',
		method: 'get',
		params,
	});
};

// 获取枚举
export const fetchWarehousingEnums = (type: string, params?: object) => {
	return request({
		url: `/product/warehouse/${type}/year`,
		method: 'get',
		params,
	});
};

// 获取选择货品页面列表
export const fetchWarehousingGoods = (params?: object) => {
	return request({
		url: `/product/warehouse/select`,
		method: 'get',
		params,
	});
};

// 导入
export const fetchImportWarehousing = (data: any) => {
	return request({
		url: '/product/warehouse/create',
		method: 'post',
		data,
	});
};

// 获取选择货品页面列表
export const fetchWarehouseDetail = (params?: object) => {
	return request({
		url: `/product/warehouse/detail`,
		method: 'get',
		params,
	});
};

// 产品大类
export const fetchProductLargeType = (params?: object) => {
	return request({
		url: `/product/warehouse/getProductLargeTypeList`,
		method: 'get',
		params,
	});
};

// 编辑
export const fetchUpdateWarehousing = (data: any) => {
	return request({
		url: '/product/warehouse/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelWarehousing = (data: any) => {
	return request({
		url: '/product/warehouse/delete',
		method: 'post',
		data,
	});
};

//---- 商品列表 -----
export const fetchGoodsStatics = (params?: object) => {
	return request({
		url: '/product/count',
		method: 'get',
		params,
	});
};
// 列表
export const fetchGoodList = (params?: object) => {
	return request({
		url: '/product',
		method: 'get',
		params,
	});
};

// 详情
export const fetchGoodDetail = (params?: object) => {
	return request({
		url: '/product/detail',
		method: 'get',
		params,
	});
};

// 新增
export const fetchCreateGood = (data: any) => {
	return request({
		url: '/product/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateGood = (data: any) => {
	return request({
		url: '/product/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelGood = (data: any) => {
	return request({
		url: '/product/delete',
		method: 'post',
		data,
	});
};

// 上下架
export const fetchGoodStatus = (data: any) => {
	return request({
		url: '/product/status',
		method: 'post',
		data,
	});
};

// 审核
export const fetchGoodAduit = (data: any) => {
	return request({
		url: '/product/check',
		method: 'post',
		data,
	});
};

// 预览
export const fetchQrCode = (data: any) => {
	return request({
		url: '/product/qrCode',
		method: 'post',
		data,
	});
};

//---- 商品同步 -----
// 列表
export const fetchSyncList = (data?: object) => {
	return request({
		url: '/product/sync/page',
		method: 'post',
		data,
	});
};

// 新增
export const fetchCreateSync = (data: any) => {
	return request({
		url: '/product/sync/create',
		method: 'post',
		data,
	});
};

// 同步详情
export const fetchSnycDetail = (params?: object) => {
	return request({
		url: '/product/getSyncDetail',
		method: 'get',
		params,
	});
};

// 免审更新
export const fetchUpdateSync = (data: any) => {
	return request({
		url: '/product/sync/updateWithoutAudit',
		method: 'post',
		data,
	});
};

// 上架
export const fetchPutAwaySync = (data: any) => {
	return request({
		url: '/product/sync/updateStatus',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelSync = (params: any) => {
	return request({
		url: '/product/sync/delete',
		method: 'get',
		params,
	});
};

// 查询类目
export const fetchTypeSync = (params: any) => {
	return request({
		url: '/product/sync/getSelectCategoryItems',
		method: 'get',
		params,
	});
};

//---- 商品分类 -----
// 列表
export const fetchTypeList = (params?: object) => {
	return request({
		url: '/product/type',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateType = (data: any) => {
	return request({
		url: '/product/type/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateType = (data: any) => {
	return request({
		url: '/product/type/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelType = (data: any) => {
	return request({
		url: '/product/type/delete',
		method: 'post',
		data,
	});
};

//---- 商品品牌 -----
// 列表
export const fetchBrandList = (params?: object) => {
	return request({
		url: '/product/brand',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateBrand = (data: any) => {
	return request({
		url: '/product/brand/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateBrand = (data: any) => {
	return request({
		url: '/product/brand/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelBrand = (data: any) => {
	return request({
		url: '/product/brand/delete',
		method: 'post',
		data,
	});
};

//---- 商品单位 -----
// 列表
export const fetchUnitList = (params?: object) => {
	return request({
		url: '/product/unit',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateUnit = (data: any) => {
	return request({
		url: '/product/unit/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateUnit = (data: any) => {
	return request({
		url: '/product/unit/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelUnit = (data: any) => {
	return request({
		url: '/product/unit/delete',
		method: 'post',
		data,
	});
};

// ----- 商品参数 -----
// 列表
export const fetchArgumentList = (params?: object) => {
	return request({
		url: '/product/argument',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateArgument = (data: any) => {
	return request({
		url: '/product/argument/create',
		method: 'post',
		data,
	});
};

// 详情
export const fetchArgumentDetail = (params?: object) => {
	return request({
		url: '/product/argument/detail',
		method: 'get',
		params,
	});
};

// 编辑
export const fetchUpdateArgument = (data: any) => {
	return request({
		url: '/product/argument/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelArgument = (data: any) => {
	return request({
		url: '/product/argument/delete',
		method: 'post',
		data,
	});
};

//---- 保障服务 -----
// 列表
export const fetchServiceList = (params?: object) => {
	return request({
		url: '/product/service',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateService = (data: any) => {
	return request({
		url: '/product/service/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateService = (data: any) => {
	return request({
		url: '/product/service/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelService = (data: any) => {
	return request({
		url: '/product/service/delete',
		method: 'post',
		data,
	});
};

//---- 物流模板 -----
// 列表
export const fetchFreightList = (params?: object) => {
	return request({
		url: '/shippingCostTemplate',
		method: 'get',
		params,
	});
};
// 新增
export const fetchCreateFreight = (data: any) => {
	return request({
		url: '/shippingCostTemplate/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateFreight = (data: any) => {
	return request({
		url: '/shippingCostTemplate/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelFreight = (data: any) => {
	return request({
		url: '/shippingCostTemplate/delete',
		method: 'post',
		data,
	});
};

// 价格趋势
// 列表
export const fetchPriceList = (data?: object) => {
	return request({
		url: '/product/price/page',
		method: 'post',
		data,
	});
};
// 新增
export const fetchCreatePrice = (data: any) => {
	return request({
		url: '/product/price/create',
		method: 'post',
		data,
	});
};

// 查询详情
export const fetchPriceDetail = (params: any) => {
	return request({
		url: '/product/price/detail',
		method: 'get',
		params,
	});
};

// 编辑
export const fetchUpdatePrice = (data: any) => {
	return request({
		url: '/product/price/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelPrice = (params: any) => {
	return request({
		url: '/product/price/delete',
		method: 'get',
		params,
	});
};
